# 因为python中对图片数据已经包装成ndarray,所以对mat的深浅拷贝，其实就是对ndarray深浅拷贝
import cv2
import numpy as np

img = cv2.imread('images/dog.jpg')

# 浅拷贝
img2 = img.view()
# 深拷贝
img3 = img.copy()

img[10:100, 10:100] = [0, 0, 255]

# cv2.imshow('img', img)
# cv2.imshow('img2', img2)
# cv2.imshow('img3', img3)
# np.hstack 横向堆叠
# np.vstack 纵向堆叠
cv2.imshow('img', np.hstack((img, img2, img3)))

cv2.waitKey(0)
cv2.destroyAllWindows()
